package com.example.springcloud.controller;

import com.example.springcloud.service.PaymentFeignService;
import com.example.springcloud.utils.ResultEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * The type Order controller.
 */
@RestController
@RequestMapping("/consumer")
@Slf4j
public class OrderController {

    @Resource
    private PaymentFeignService paymentFeignService;

    /**
     * Gets payment.
     *
     * @param id the id
     * @return the payment
     */
    @GetMapping("/payment/get/{id}")
    public ResultEntity getPayment(@PathVariable(value = "id") Long id) {

        return paymentFeignService.getPayment(id);
    }

    @GetMapping("/payment/feignTimeoutTest")
    public String feignTimeoutTest() throws InterruptedException {

        return paymentFeignService.feignTimeoutTest();
    }

}
